package com.feng.financial.common.exception;

import org.apache.commons.lang3.StringUtils;

/**
 * @author Lee
 */
public enum ErrorCode {

    ERROR("999999","交易失败"),
    SUCCESS("000000","交易成功"),
    AUTHORING_ERROR("000001","授权错误"),
    PARAM_ERROR("000002","请求参数错误"),
    SYSTEM_ERROR("000003","系统内部错误"),
    OTHER("999999","其他错误");

    String statusCode;
    String statusDesc;

    ErrorCode(String statusCode,String statusDesc){
        this.statusCode = statusCode;
        this.statusDesc = statusDesc;
    }

    public static ErrorCode getInstance(String statusCode){
        for (ErrorCode value : values()) {
            if (StringUtils.equals(value.getStatusCode(),statusCode)) {
                return value;
            }
        }
        return OTHER;
    }
    
    public String getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(String statusCode) {
        this.statusCode = statusCode;
    }

    public String getStatusDesc() {
        return statusDesc;
    }

    public void setStatusDesc(String statusDesc) {
        this.statusDesc = statusDesc;
    }
    
}
